const Router = require("koa-router")

const commentRouter = new Router({prefix:"/comment"})
const {create,reply,update,remove,list} = require("../controller/comment.constroller")
const {verifyAuth,verifyPermission} = require("../middleware/auth.middleware")

commentRouter.get("/",list); //获取评论列表
commentRouter.post("/",verifyAuth,create)  //创建评论
commentRouter.post("/:commentId/reply",verifyAuth,reply) //回复评论
commentRouter.patch("/:commentId",verifyAuth,verifyPermission("comment"),update)//修改评论
commentRouter.delete("/:commentId",verifyAuth,verifyPermission("comment"),remove)//删除评论



module.exports = commentRouter